# 常用占位符
# %s 格式化字符串
name = "Alice"
print("Hello, %s!" % name)

# %d 格式化整数
age = 30.003
print("I am %d years old." % age)

# %f 格式化浮点数
height = 1.75
print("My height is %.2f meters." % height)

# %x 和 %X 用户格式化十六进制, %x 格式化为小写 %X 格式化为大写
num = 255
print("The hexadecimal representation of %d is %x. %X" % (num, num, num))

# format 格式
name = "Bob"
age = 25
print("My name is {} and I am {} years old.".format(name, age))
name = "Charlie"
age = 20
print(f"My name is {name} and I am {age} years old.")
